package com.owg.jigsaw.blocktypes;

import java.awt.Component;
import java.awt.Panel;

import com.owg.jigsaw.WBlock;
import com.owg.jigsaw.WBlockBase;
import com.owg.jigsaw.WRoot;
import com.owg.jigsaw.slots.MultiSlot;

import javafx.scene.paint.Color;

/**
 * A panel block. A panel block has a slot list.
 */
public abstract class WPanelBlockBase extends WBlockBase implements WComponentBlock
{
	public final boolean isVertical;
	
	protected MultiSlot children;
	public WPanelBlockBase(WRoot root, boolean isPaletteBlock, boolean isVertical)
	{
		super(root, Panel.class, isPaletteBlock, Color.ALICEBLUE);
		this.isVertical = isVertical;
	}
	
	
	@Override
	public Component getComponent()
	{
		Panel p = new Panel();
		installLayout(p);
		for(WBlock child : children.children)
		{
			p.add(((WComponentBlock)child).getComponent());
		}
		return p;
	}

	protected abstract void installLayout(Panel p);
}
